package Handlers

import (
	"TCPServer/Interfaces"
	__ "TCPServer/ProtoFiles"
	"TCPServer/Service"
	"fmt"
	"github.com/golang/protobuf/proto"
)

type Handler01 struct {
	Service.BaseRouter
}

func NewHandler01() *Handler01 {
	return &Handler01{}
}

func (h *Handler01) Handle(req Interfaces.IRequest) {
	hello := __.HelloRequest{}
	proto.Unmarshal(req.GetData(), &hello)
	fmt.Println(hello.Msg)
	hello2 := __.HelloRequest{Msg: "nihaoya"}
	hellob, _ := proto.Marshal(&hello2)
	msg := Service.NewMessage(5, hellob)
	b2, _ := msg.Pack()
	req.GetConnection().SendMsg(b2)
	
	//first: createRoom
	//Room: map  ConnID
	//Calculate:
	//1 按照速度排序
	//2 获得攻击角色的属性
	//3 获得攻击属性
	//4 计算攻击结果
	//4 生成序列发回客户端
}
